package com.aac.rabbitrfc.controller;

import com.aac.rabbitrfc.service.BpmToSapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * BPM从SAP获取数据的统一接口类
 * @author Weng Zhengkai
 */
@RestController
@RequestMapping(value = "/sap")
public class BpmToSapController {

    @Autowired
    private BpmToSapService bpmToSapService;

    /**
     * HTTP接口定义处
     * Postman中选择POST请求，请求体选择raw -> application/json类型
     * 请求体中的Json数据写法请参照《SAP统一接口文档》
     *
     * @param requestMap 前端请求体中携带的Json数据
     * @return 返回result给响应体
     */
    @RequestMapping(value = "/json")
    public Map<String, Object> getSapJson(@RequestBody Map<String, Object> requestMap) {
        return bpmToSapService.getSapJson(requestMap);
    }

}
